/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: WHY
 * Date: 2022-05-03
 * Time: 12:30
 */

/**
 * 记录移动轨迹
 */
//青蛙跳台阶递归实现
public class TestDemo {
    public static int  jumpFloor(int n){
        if(n==1){
            return 1;
        }
        if(n==2){
            return 2;
        }
        int tmp=jumpFloor(n-1)+jumpFloor(n-2);
        return tmp;
    }
    public static void main(String[] args) {
        int ret=jumpFloor(5);
        System.out.println(ret);

    }





    public static void move(char s1,char s2){
        System.out.print( s1+ "->" +s2  );

    }

    /**
     *
     * @param n   盘子数
     * @param s1   起始位置与目的位置
     * @param s2
     * @param s3
     *///实现汉诺塔的函数递归实现
    public static void honi(int n,char s1,char s2,char s3){
                    if(n==1){
                        move( s1, s3);
                    }else{
                        honi(n-1,s1,s3,s2);
                        move( s1, s3);
                       honi(n-1,s2,s1,s3);

                    }

    }

    public static void main1(String[] args) {
        honi(1,'A','B','C');
        System.out.println();
        honi(2,'A','B','C');
        System.out.println();
        honi(3,'A','B','C');
        System.out.println();
    }

}
